{include file="header.html"}

<div class="page-header">
	<h6>
		广告管理
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			广告添加
		</small>
	</h6>
</div>
<div class="row">
<div class="col-xs-12">
	<form class="form-horizontal" role="form" method="post" action="?app=ad&act=save" enctype="multipart/form-data">
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right" for="name"> 广告标题 </label>
			<div class="col-sm-10">
				<input type="text" id="name" name="name" value="" class="col-xs-6" />
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right" for="pic"> 广告图片 </label>
			<div class="col-sm-10">
				<div class="col-file col-xs-3"><input type="file" id="pic" name="pic" value="" /></div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right" for="ad_type"> 广告类型 </label>
			<div class="col-sm-2">
				<select name="ad_type" id="ad_type" class="form-control">
					<option value="">请选择类型</option>
					{foreach from=$types item=g}
					<option value="{$g->name}">{$g->value}</option>
					{/foreach}
				</select>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-2 control-label no-padding-right"></div>
			<div class="col-sm-10">
				<ol>
					{foreach from=$types item=g}
					{if $g->memo!=''}<li>{$g->memo}</li>{/if}
					{/foreach}
				</ol>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right" for="ad_content"> 广告内容 </label>
			<div class="col-sm-10">
				<input type="text" id="ad_content" name="ad_content" value="" class="col-xs-6" />
				<span class="some-line">(可以是id或者链接或者关键词)</span>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right" for="position"> 广告位置 </label>
			<div class="col-sm-2">
				<select name="position" id="position" class="form-control">
					<option value="">请选择位置</option>
					{foreach from=$positions item=g}
					<option value="{$g->name}">{$g->value}</option>
					{/foreach}
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right" for="offer">  </label>
			<div class="col-sm-10">
				<div class="checkbox">
					<label>
						<input type="checkbox" name="offer" value="1"  class="ace" />
						<span class="lbl"> 同时发送优惠消息 </span>
					</label>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right" for="status"> 状态 </label>
			<div class="col-sm-10">
				<div class="radio">
					<label>
						<input type="radio" name="status" value="1" checked class="ace" />
						<span class="lbl"> 显示 </span>
					</label>
				</div>
				<div class="radio">
					<label>
						<input type="radio" name="status" value="2" class="ace" />
						<span class="lbl"> 隐藏 </span>
					</label>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right" for="service_time"> 优惠开始时间 </label>
			<div class="col-sm-10">
				<input type="text" class="col-xs-4" name="begin_time" id="begin_time" placeholder="开始时间" value="" initdate="" />
				<span class="some-line">到了此日期/时间，优惠将显示出来</span>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right" for="service_time"> 优惠结束时间 </label>
			<div class="col-sm-10">
				<input type="text" class="col-xs-4" name="end_time" id="end_time" placeholder="结束时间" value="" initdate="" />
				<span class="some-line">到了此日期/时间，优惠将结束</span>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right" for="channel"> 投放渠道</label>
			<div class="col-sm-2">
				<select name="channel" id="channel" class="form-control">
					<option value="">请选择投放渠道</option>
					<option value="0">全渠道</option>
					<option value="1">苹果+安卓</option>
					<option value="2">苹果</option>
					<option value="3">安卓</option>
					<option value="4">微信</option>
					<option value="5">web</option>
				</select>
			</div>
		</div>
		{if is_array($shop) && count($shop)}
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right" for="shop_id"> 所属商家 </label>
			<div class="col-sm-10">
				<select name="shop_id" id="shop_id">
					<option value="-1">请选择所属商家</option>
						<option value="0">全站广告</option>
						{foreach from = $shop item =row}
						<option value="{$row->id}">{$row->name}</option>
						{/foreach}
				</select>
				<span class="some-line" style="color:red;">（当shop_id>0，为该商家内的广告，shop_id=0，为全站广告）</span>
			</div>
		</div>
		{/if}
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right" for="sort"> 排序 </label>
			<div class="col-sm-10">
				<input type="text" id="sort" name="sort" value="999" class="col-xs-2" />
			</div>
		</div>

		<div class="clearfix form-actions">
			<div class="col-md-offset-3 col-md-9">
				<button class="btn btn-info" type="submit">
					<i class="ace-icon fa fa-check bigger-110"></i>
					提交
				</button>

				&nbsp; &nbsp; &nbsp;
				<button class="btn" type="reset">
					<i class="ace-icon fa fa-undo bigger-110"></i>
					重置
				</button>
			</div>
		</div>
	</form>
</div>
</div>

{include file="footer.html"}
<script>
$(function(){
	$('#begin_time').datepicker();
	$('#end_time').datepicker();
});
</script>

